package com.miyuan.wm.controller;

import com.alibaba.fastjson.JSON;
import com.miyuan.wm.request.QueryRecordStorageRequestVo;
import com.miyuan.wm.response.PageResponse;
import com.miyuan.wm.response.QueryRecordStorageResponseVo;
import com.miyuan.wm.service.StorageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @ClassName StorageController
 * @Description 库存管理控制器
 */
@RestController
@Api(description = "库存管理控制器", tags = {"库存管理"})
@RequestMapping(value = "/storage")
@Slf4j
public class StorageController {

    @Autowired
    private StorageService storageService;

    @ApiOperation(value = "获取库存列表接口")
    @PostMapping("/listRecordStorage")
    public PageResponse<List<QueryRecordStorageResponseVo>> listRecordStorage(@Valid @RequestBody QueryRecordStorageRequestVo requestVo) {
        log.info("获取库存列表接口请求参数：{}", JSON.toJSONString(requestVo));
        return storageService.listRecordStorage(requestVo);
    }

}
